package br.mikhas.db.model.factory;

import java.io.Serializable;
import java.util.ArrayList;

import br.mikhas.db.model.Field;
import br.mikhas.db.model.Index;
import br.mikhas.db.model.Model;
import br.mikhas.db.util.ReflectionUtils;
import br.mikhas.util.Assert;

public class DataBaseModel extends Model {

	DataBaseModel(Class<? extends Serializable> cls) {
		Assert.notNull(cls);
		this.className = cls.getName();
		this.modelClass = cls;
		this.classSerial = ReflectionUtils.getClassSerial(cls);

		this.fields = new ArrayList<Field>();
	}

	void addField(Field field) {
		Assert.notNull(field);
		this.fields.add(field);
	}

	public void setIndex(Index index) {
		this.index = index;
	}

	public void setLength(int modelLength) {
		this.length = modelLength;
	}
}
